package com.authsphere.bootstrap.web.controller;

import com.authsphere.common.result.ResponseResult;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: AuthSphere
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/14 16:40
 **/
@RestController
@RequestMapping("/qrcode")
public class WebQRController {

    /**
     * 生成二维码id
     * @return
     */
    @GetMapping("/generateId")
    public ResponseResult<Void> generateQrId(HttpServletRequest request) {
        return ResponseResult.ofSuccess();
    }

    /**
     * 生成二维码图片
     * @return
     */
    @GetMapping("/generate")
    public ResponseResult<Void> generateQrCode(
            @RequestParam("lgToken") String lgToken,
            @RequestParam(value = "width", required = false) Integer width,
            @RequestParam(value = "height", required = false) Integer height,
            HttpServletRequest request
    ) {
        return ResponseResult.ofSuccess();
    }

    /**
     * 获取二维码状态
     * @param lgToken
     * @return
     */
    @GetMapping("/state")
    public ResponseResult<Void> getQrCodeState(@RequestParam("lgToken") String lgToken) {
        return ResponseResult.ofSuccess();
    }

    /**
     * 扫描二维码
     * @param token
     * @param lgToken
     * @return 临时token
     */
    @GetMapping("/scan")
    public ResponseResult<Void> scanQrCode(@RequestParam("token") String token, @RequestParam("lgToken") String lgToken) {
        return ResponseResult.ofSuccess();
    }

    /**
     * 确认登录, 使用过滤器
     * @param tempToken
     * @param lgToken
     * @return 临时token
     */
}
